<?php
require_once WEB_MODEL_DIR . DIRECTORY_SEPARATOR . 'DAO' . DIRECTORY_SEPARATOR . 'DeviceDAO.php';

class DeviceService {
    
	public function getDeviceByID($context, $result, $id) {
        $deviceArr = null;
        try {
            $deviceDAO = new DeviceDAO($context);

            $deviceArr = $deviceDAO -> getDeviceByID($id);

        } catch (Exception $e) {
            $result -> setException($e);
            $context -> logException($e);
        }
        return $deviceArr;
    }
	
	public function getFullDevice($context, $result) {
        $deviceArr = null;
        try {
            $deviceDAO = new DeviceDAO($context);

            $deviceArr = $deviceDAO -> getFullDevice();

        } catch (Exception $e) {
            $result -> setException($e);
            $context -> logException($e);
        }
        return $deviceArr;
    }
    

	public function insertDevice($context, $result, $param) {
        try {

            $deviceDAO = new DeviceDAO($context);

            $deviceDAO -> insertDevice($param);
        } catch (Exception $e) {
            $result -> setException($e);
            $context -> logException($e);
        }
    }
    
	public function updateDevice($context, $result, $param) {
        try {

            $deviceDAO = new DeviceDAO($context);

            $deviceDAO -> updateDevice($param);
        } catch (Exception $e) {
            $result -> setException($e);
            $context -> logException($e);
        }
    }
    
	public function deleteDevice($context, $result, $param) {
        try {

            $deviceDAO = new DeviceDAO($context);

            $deviceDAO -> deleteDevice($param);
        } catch (Exception $e) {
            $result -> setException($e);
            $context -> logException($e);
        }
    }
    	   
}
?>